﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Atomic.Permission.Entities;
using System.Linq.Expressions;
using NHibernate.Linq;
using Atomic.Db;
using Atomic.Common;
using Atomic.Permission.DAL;

namespace Atomic.Permission.BLL
{
    public class FunPointBLL : ErrorImpl, IFunPoint
    {

        /// <summary>
        /// 更新操作点
        /// </summary>
        /// <param name="entity">操作点信息</param>
        /// <param name="id">操作点ID</param>
        public virtual bool Update(FunPointEntity entity, int id)
        {
            FunPointDAL funPointDAL = new FunPointDAL();
            funPointDAL.Update(entity, id);
            return true;
        }

        /// <summary>
        /// 条件查询列表
        /// </summary>
        /// <param name="predicate">查询条件</param>
        public virtual List<FunPointEntity> GetList(Expression<Func<FunPointEntity, bool>> predicate = null)
        {
            FunPointDAL funPointDAL = new FunPointDAL();
            return funPointDAL.GetList(predicate);
        }


        /// <summary>
        /// 添加新功能操作点
        /// </summary>
        /// <param name="entity">操作点信息</param>
        /// <returns>是否添加成功</returns>
        public virtual bool Add(FunPointEntity entity)
        {
            FunPointDAL funPointDAL = new FunPointDAL();
            funPointDAL.Add(entity);
            return true;
        }
        
        /// <summary>
        /// 删除指定功能点
        /// </summary>
        /// <param name="id">功能点ID</param>
        /// <returns>是否删除成功</returns>
        public bool Remove(int id)
        {
            FunPointDAL funPointDAL = new FunPointDAL();
            funPointDAL.Remove(id);
            return true;
        }
    }
}
